import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    name: 'home',
    component: () => import('../views/AppHome.vue'),
    children:[
      {
        path: '/index',
        name: 'Index',
        component: () => import('@/components/index/indexView.vue')
      },
      {
        path:"/",
        redirect:'/index'
      },
      {
        path: '/cate',
        name: 'cate',
        component: () => import('../components/category/CateView.vue')
      },
      {
        path: '/reclassify',
        name: 'reclassify',
        component: () => import('../components/tree/reclassify.vue')
      },
      {
        path: '/detail',
        name: 'detail',
        component: () => import('../components/goodsdetail/detailview.vue')
      },
      //CartPage
      {
        path: '/cart',
        name: 'detail',
        component: () => import('../components/shop/CartPage.vue')
      },
      
      {
        path: '/pay',
        name: 'pay',
        component: () => import('../components/pay/PayCheckoutPage.vue')
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/AppLogin.vue')
  },
  {
    path: '/appError',
    name: 'appError',
    component: () => import('../views/AppError.vue')
  },
  {
    path: '/login/callback',
    name: 'logincallback',
    component: () => import('../components/login/logincallback.vue')
  }
]

const router = new VueRouter({
  // mode: 'history',
  routes,
  scrollBehavior(){
    return {x:0,y:0}
  }

})

export default router
